(SST) ShlWAPI.pas Version 1.08

Developer Reference
(SST)ShlWAPI PathIsRoot Function
Determines if a path string represents a root folder.
Scope
Global (i.e. this function can be called/accessed from code in any unit that includes/uses (SST)ShlWAPI.pas).
Syntax
function PathIsRoot(pszPath : LPCSTR) : BOOL;
Parameters
pszPath [in] A pointer to a zero-terminated path string with a moximum length of MAX_PATH (= 260) characters (including the terminating zero).
Return Values
Returns TRUE if the string represents (and is limited to) a root folder, FALSE otherwise.
Remarks
The function does not verify the existence of the specified path
Relative paths, even if they refer to a root path, are not considered root paths by this function.
Universal Naming Convention (UNC) paths may include a share name as in "\\SAMPLESERVER\SampleShare" (without the quotation marks) and are therefore also considered root paths.
Example
PROCEDURE TForm4.TestShlWAPIPathIsRoot(Sender : TObject);

VAR pathtotest : STRING;
VAR apiretval : BOOL;
VAR newinfoline : STRING;

  BEGIN
pathtotest := '';
apiretval := FALSE;
newinfoline := '';

pathtotest := 'C:\Hello\Windows\World';
newinfoline := 'PathIsRoot called with ' + pathtotest;
Memo1.Lines.Add(newinfoline);
apiretval := PathIsRoot(PChar(pathtotest));
IF apiretval THEN
newinfoline := 'TRUE'
ELSE
newinfoline := 'FALSE';
Memo1.Lines.Add(newinfoline);

pathtotest := 'X:\';
newinfoline := 'PathIsRoot called with ' + pathtotest;
Memo1.Lines.Add(newinfoline);
apiretval := PathIsRoot(PChar(pathtotest));
IF apiretval THEN
newinfoline := 'TRUE'
ELSE
newinfoline := 'FALSE';
Memo1.Lines.Add(newinfoline);

pathtotest := '\\FILESERVER1\Public';
newinfoline := 'PathIsRoot called with ' + pathtotest;
Memo1.Lines.Add(newinfoline);
apiretval := PathIsRoot(PChar(pathtotest));
IF apiretval THEN
newinfoline := 'TRUE'
ELSE
newinfoline := 'FALSE';
Memo1.Lines.Add(newinfoline);

Memo1.Lines.Add('');
  END;
The above example will generally produce the following output:
PathIsRoot called with C:\Hello\Windows\World
FALSE
PathIsRoot called with X:\
TRUE
PathIsRoot called with \\FILESERVER1\Public
TRUE
Requirements
Unit: Declared and imported in (SST)ShlWAPI.pas
Library: (SST)ShlWAPI.dcu/(SST)ShlWAPI.obj
Unicode: Implemented as ANSI (PathIsRoot and PathIsRootA) and Unicode (PathIsRootW) functions.
Min. ShlWAPI.dll version according to MS SDK doc.: 4.7
Min. ShlWAPI.dll version based on SST research: 4.71
Min. OS version(s) according to Microsoft SDK doc.: Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0
Min. OS version(s) according to SST research.: Windows NT 4.0 with IE 4.0, Windows 95 with IE 4.0, Windows 98, Windows 2000 and later
See Also
PathIsDirectory.
 
Windows APIs: PathIsRoot, PathIsSameRoot, PathIsRelative, PathIsSystemFolder, PathIsUNCServer, PathIsUNCServerShare PathIsURL, PathIsFileSpec, PathIsLFNFileSpec, PathIsPrefix, PathIsUNC, PathMatchSpec, PathMatchSpecEx, PathRemoveFileSpec.


Document/Contents version 1.00
Page/URI last updated on 07.12.2023
 
Copyright © Stoelzel Software Technologie (SST) 2010 - 2017
Suggestions and comments mail to:
webmaster@stoelzelsoftwaretech.com